package io.lvdaxian.mybatis07.reflection.factory;

import java.util.List;
import java.util.Properties;

/**
 * 表示对象工厂 接口
 *
 * @author lihh
 */
public interface ObjectFactory {
  void setProperties(Properties properties);
  
  /**
   * Creates a new object with default constructor.
   * 生产对象
   *
   * @param type Object type
   * @return <T>
   */
  <T> T create(Class<T> type);
  
  /**
   * Creates a new object with the specified constructor and params.
   * 生产对象，使用指定的构造函数和构造函数参数
   *
   * @param type                Object type
   * @param constructorArgTypes Constructor argument types
   * @param constructorArgs     Constructor argument values
   * @return <T>
   */
  <T> T create(Class<T> type, List<Class<?>> constructorArgTypes, List<Object> constructorArgs);
  
  /**
   * Returns true if this object can have a set of other objects.
   * It's main purpose is to support non-java.util.Collection objects like Scala collections.
   * 返回这个对象是否是集合，为了支持 Scala collections
   *
   * @param type Object type
   * @return whether it is a collection or not
   * @since 3.1.0
   */
  <T> boolean isCollection(Class<T> type);
}
